package com.tqyan.util;

/**
 * 禁用词工具
 * <p> <功能详细描述> </p>
 *
 * @author 陈晨
 * @version 1.0
 * @date 2023/4/17
 */
public abstract class DisableWordUtil {

    private static final String[] DISABLE_WORDS = {
            "装逼", "草泥马", "特么的", "撕逼", "玛拉戈壁", "爆菊", "JB", "呆逼", "本屌", "齐B短裙", "法克鱿"
            , "丢你老母", "达菲鸡", "装13", "逼格", "蛋疼", "傻逼", "绿茶婊", "你妈的", "表砸", "屌爆了", "买了个婊"
            , "已撸", "吉跋猫", "妈蛋", "逗比", "我靠", "碧莲", "碧池", "然并卵", "日了狗", "屁民", "吃翔", "XX狗"
            , "淫家", "你妹", "浮尸国", "滚粗", "杀人"
    };

    private DisableWordUtil() {}

    /**
     * @description 是否包含禁用词
     * <p> <功能详细描述> </p>
     *
     * @author 陈晨
     * @date 2023/4/17 22:23
     */
    public static boolean containsDisable(String content) {
        for (String words : DISABLE_WORDS) {
            if (content.contains(words)) {
                return true;
            }
        }
        return false;
    }

    /**
     * @description 过滤禁用词
     * <p> <功能详细描述> </p>
     *
     * @author 陈晨
     * @date 2023/4/17 22:23
     */
    public static String filter(String content) {
        String localContent = content;
        for (String words : DISABLE_WORDS) {
            localContent = localContent.replaceAll(words, "**");
        }
        return localContent;
    }

}


